﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace Library
{
	public class LightSource
	{
		public Vector2 position;
		Color color;
		float distance;

		public LightSource(Vector2 position, Color color, float intensity)
		{
			this.position = position;
			this.color = color;
			this.distance = intensity;
		}
		public float CalculateBrightness(Sprite sprite)
		{
			float distance = (float)Math.Sqrt(Math.Pow((sprite.position.Y + sprite.Height / 2) - position.Y, 2) + Math.Pow((sprite.position.X + sprite.Width / 2) - position.X, 2));
			if (this.distance > distance)
			{
				return (distance/this.distance) *1.0f;
			}
			return 1;
		}

	}
}
